package com.samphanie.auiu.http.api

import com.samphanie.auiu.http.ApiFactory
import com.samphanie.auiu.library.restful.AuiuCall
import com.samphanie.auiu.library.restful.annotation.Filed
import com.samphanie.auiu.library.restful.annotation.Get
import com.samphanie.auiu.library.restful.annotation.Path
import com.samphanie.auiu.library.restful.annotation.Post
import com.samphanie.auiu.model.GoodsDetailModel
import com.samphanie.auiu.model.GoodsFavorite
import com.samphanie.auiu.model.GoodsList

/**
 * @author ZSY
 */
interface GoodsApi {

    @Get("/auiu-app/v1/open_api/goods/{cateId}/list")
    fun queryCategoryGoodsList(
        @Path("cateId") cateId: String,
        @Filed("subCateId") subCateId: String,
        @Filed("pageNum") pageNum: Int,
        @Filed("pageSize") pageSize: Int
    ) : AuiuCall<GoodsList>

    @Get("/auiu-app/v1/open_api/goods/detail/{id}")
    fun queryGoodsDetail(
        @Path("id") id: String,
    ) : AuiuCall<GoodsDetailModel>

    @Post("/auiu-app/v1/open_api/goods/favorite/{goodsId}")
    fun favoriteGoods(
        @Path("goodsId") goodsId: String,
    ) : AuiuCall<GoodsFavorite>

    companion object {
        fun create(): GoodsApi {
            return ApiFactory.create(GoodsApi::class.java)
        }
    }
}

fun goodsApiService(): GoodsApi {
    return GoodsApi.create()
}